package com.swpu.zdl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.swpu.zdl.pojo.Student;
import com.swpu.zdl.pojo.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {
    @Select("select * from  teacher")
    List<Teacher> getAll();
    @Insert("insert into teacher(gong_hao, teacher_name, yuan_xi, gender, phone, cid)" +
            "values (#{gongHao},#{teacherName},#{yuanXi},#{gender},#{phone},#{cid})")
    boolean addTeacher(Teacher teacher);
    @Delete("delete from teacher where gong_hao = #{gongHao}")
    boolean deleteTeacher(String gongHao);

    boolean updateTeacher(@Param("gonghao") String gongHao,
                          @Param("teacher") Teacher teacher);
    @Select("SELECT t.*,k.* from teacher t JOIN teacher_kecheng tk on t.gong_hao=tk.gong_hao JOIN kecheng k on \n" +
            "k.kno=tk.kno where t.gong_hao=#{gongHao}")
    @ResultMap("TeacherMap")
    Teacher getTeacherKp(String gongHao);
}
